package com.wanlian.router.ui.manage;

import android.os.Bundle;
import android.os.Handler;
import android.view.View;

import com.smart.android.ui.BaseFragment;
import com.smart.android.ui.tools.BaseListFragment;
import com.wanlian.router.bean.NetDevice;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Hyu on 2018/9/8.
 * Email: fvaryu@163.com
 */
public class NetworkingDeviceFragment extends BaseListFragment {
    private NetworkingDeviceAdapter mNetworkingDeviceAdapter;
    private List<NetDevice> mNetDevices;


    public static NetworkingDeviceFragment newInstance() {

        Bundle args = new Bundle();

        NetworkingDeviceFragment fragment = new NetworkingDeviceFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected void initUI(View view) {
        super.initUI(view);
        mNetDevices = new ArrayList<>();
        mNetDevices.add(new NetDevice());
        mNetDevices.add(new NetDevice());
        mNetDevices.add(new NetDevice());

        setAdapter(mNetworkingDeviceAdapter = new NetworkingDeviceAdapter(getActivity(), mNetDevices));
    }

    @Override
    protected void initData(View view) {
        super.initData(view);
    }

    @Override
    protected void loadData(boolean isRefresh) {
        super.loadData(isRefresh);
        if (!canToLoad(isRefresh)) {
            return;
        }

        new Handler().post(new Runnable() {
            @Override
            public void run() {
              resetPull();
            }
        });
    }
}
